package lol.clann.minecraft.springboot.plugin.bukkit.register;

import com.google.auto.service.AutoService;
import lol.clann.minecraft.springboot.api.spi.bean.BeanRegister;
import lol.clann.minecraft.springboot.bukkit.plugin.AdapterContext;
import org.bukkit.Bukkit;

import java.util.HashMap;
import java.util.Map;

/**
 * 注册bukkit下的各种对象到到beanFactory
 * @author pyz
 * @date 2019/4/8 9:26 PM
 */
@AutoService(BeanRegister.class)
public class BukkitObjectRegister implements BeanRegister {

    @Override
    public Map<String, Object> getBasePackages() {
        Map<String, Object> map = new HashMap<>();
        if (AdapterContext.isBukkit()) {
            map.put("server", Bukkit.getServer());
            map.put("consoleSender", Bukkit.getConsoleSender());
            map.put("servicesManager", Bukkit.getServicesManager());
            map.put("scoreboardManager", Bukkit.getScoreboardManager());
            map.put("bukkitScheduler", Bukkit.getScheduler());
            map.put("pluginManager", Bukkit.getPluginManager());
            map.put("messenger", Bukkit.getMessenger());
            map.put("itemFactory", Bukkit.getItemFactory());
        }
        return map;
    }

}

